Index

What Is Logic?


Definition


A search for "logic" will produce an overwhelming collection of results.

Here is our best shot at a definition for logic:

making a decision based on a true or false condition

Examples


Let's say we are biking up to a traffic control sign/signal.

True Condition -- Go

Logic: Is the sign green? It is true that the sign is green, so I decide to continue through it

False Condition -- Stop

Logic: Is the sign green? It is false that the sign is green, so I decide to stop at it

Boolean


Definition


The true/false value we described in "logic" is called a boolean (value type).

Compare:


Is Boolean Useful?


Think of boolean as the little engine that drives our machines (yes it is important).

Think about how many things you do based on just yes/no (true/false).

Condition


Condition is a popular word in coding. We'll see it a lot.

Think of a condition as a question that results in a boolean (true/false).

Examples:

Is the traffic signal green?
no
Am I thirsty?
yes
Is it cold out?
yes
Is the price fair?
no

Terms


boolean
A value type with two possible values: true, false
logic
making a decision based on a true or false condition
logic (w. boolean)
making a decision based on a boolean value
true
Means yes, affirmative, yes, yea, positive -- one of two possible values of a boolean type
false
Means no, negative, nope, nay -- one of two possible values of a boolean type
yes
Another word we use for 'true'
no
Another word we use for 'false'
condition
A question that results in a boolean (true/false). Is the traffic signal green?
expression
produces a result value
logical expression
produces a boolean result value